package com.sb.money.dao.impl;

import com.sb.money.dao.SubcategoryDao;

import com.sb.money.entities.Subcategory;

import java.util.List;

import org.apache.tapestry5.annotations.Log;

/**
 * @author stefan
 */
public class SubcategoryDaoImpl extends AbstractDaoImpl<Subcategory> implements
        SubcategoryDao {

    /**
     * default constructor.
     */
    public SubcategoryDaoImpl() {
        super();
    }

    @SuppressWarnings("unchecked")
    @Log
    @Override
    public final List<Subcategory> findAll() {
        List<Subcategory> result  = this.getSession()
                .createCriteria(Subcategory.class).list();
        if (result == null || result.isEmpty()) {
            result = null;
        }
        
        return result;
    }
}